home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kmenubar.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.5 KB  |  115 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 1997, 1998, 1999, 2000  Sven Radej (radej@kde.org)
  3.     Copyright (C) 1997, 1998, 1999, 2000 Matthias Ettrich (ettrich@kde.org)
  4.     Copyright (C) 1999, 2000 Daniel "Mosfet" Duley (mosfet@kde.org)
  5.  
  6.  
  7.     This library is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU Library General Public
  9.     License as published by the Free Software Foundation; either
  10.     version 2 of the License, or (at your option) any later version.
  11.  
  12.     This library is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.     Library General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU Library General Public License
  18.     along with this library; see the file COPYING.LIB.  If not, write to
  19.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20.     Boston, MA 02110-1301, USA.
  21. */
  22.  
  23. //$Id: kmenubar.h 465272 2005-09-29 09:47:40Z mueller $
  24.  
  25. #ifndef _KMENUBAR_H
  26. #define _KMENUBAR_H
  27.  
  28. #include <qmenubar.h>
  29.  
  30. #include <kdelibs_export.h>
  31.  
  32. /**
  33.  * %KDE Style-able menubar.
  34.  *
  35.  * This is required since QMenuBar is currently not handled by
  36.  * QStyle.
  37.  *
  38.  * @author Daniel "Mosfet" Duley.
  39.  * @version $Id: kmenubar.h 465272 2005-09-29 09:47:40Z mueller $
  40. */
  41.  
  42. class KDEUI_EXPORT KMenuBar : public QMenuBar
  43. {
  44.     Q_OBJECT
  45.  
  46. public:
  47.  
  48.     KMenuBar (QWidget *parent=0, const char *name=0);
  49.     ~KMenuBar ();
  50.  
  51.     /**
  52.      * This controls whether or not this menubar will be a top-level
  53.      * bar similar to the way Macintosh handles menubars.  This
  54.      * overrides any global config settings.
  55.      *
  56.      * Keep in mind that it is probably a really bad idea to use this
  57.      * unless you really know what you're doing.  A feature like a
  58.      * top-level menubar is one that should really be shared by all
  59.      * applications.  If your app is the only one with a top-level
  60.      * bar, then things might look very... odd.
  61.      *
  62.      * This is included only for those people that @p do know that
  63.      * they need to use it.
  64.      *
  65.      * @param top_level If set to true, then this menubar will be a
  66.      *                  top-level menu
  67.      */
  68.     void setTopLevelMenu(bool top_level = true);
  69.  
  70.     /**
  71.      * Is our menubar a top-level (Macintosh style) menubar?
  72.      *
  73.      * @return True if it is top-level.
  74.      */
  75.     bool isTopLevelMenu() const;
  76.  
  77.     // TT are overloading virtuals :(
  78.     virtual void setGeometry( const QRect &r );
  79.     virtual void setGeometry( int x, int y, int w, int h );
  80.     virtual void resize( int w, int h );
  81.     void resize( const QSize& s ) { QMenuBar::resize( s ); }
  82.  
  83.     virtual void show();
  84.     virtual void setFrameStyle( int );
  85.     virtual void setLineWidth( int );
  86.     virtual void setMargin( int );
  87.     virtual QSize sizeHint() const;
  88. protected slots:
  89.     void slotReadConfig();
  90. protected:
  91.     virtual void showEvent( QShowEvent* );
  92.     virtual void resizeEvent( QResizeEvent* );
  93.     virtual bool eventFilter(QObject *, QEvent *);
  94. #ifdef Q_WS_X11
  95.     virtual bool x11Event( XEvent* );
  96. #endif
  97.     virtual void closeEvent( QCloseEvent* );
  98.     virtual void drawContents( QPainter* );
  99. private slots:
  100.     void updateFallbackSize();
  101.     void selectionTimeout();
  102. private:
  103.     void setTopLevelMenuInternal(bool top_level);
  104.     void updateMenuBarSize();
  105.     void checkSize( int& w, int& h );
  106.     static int block_resize;
  107. protected:
  108.     virtual void virtual_hook( int id, void* data );
  109. private:
  110.     class KMenuBarPrivate;
  111.     KMenuBarPrivate *d;
  112. };
  113.  
  114. #endif
  115.